home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Programare / bluej / bluejsetup-203.exe / {app} / examples / people2 / Student.java < prev   
Text File  |  2004-12-19  |  1KB  |  48 lines

  1. /**
  2.  * A class representing students for a simple BlueJ demo program.
  3.  *
  4.  * @author  Michael Kolling
  5.  * @version 1.0, January 1999
  6.  */
  7. class Student extends Person
  8. {
  9.     private String SID;    // student ID number
  10.  
  11.     /**
  12.      * Create a student with default settings for detail information.
  13.      */
  14.     public Student()
  15.     {
  16.         super("(unknown name)", 0000);
  17.         SID = "(unknown ID)";
  18.     }
  19.  
  20.     /**
  21.      * Create a student with given name, year of birth and student ID
  22.      */
  23.     public Student(String name, int yearOfBirth, String studentID)
  24.     {
  25.         super(name, yearOfBirth);
  26.         SID = studentID;
  27.     }
  28.  
  29.     /**
  30.      * Return the stident ID of this student.
  31.      */
  32.     public String getStudentID()
  33.     {
  34.         return SID;
  35.     }
  36.  
  37.     /**
  38.      * Return a string representation of this object.
  39.      */
  40.     public String toString()    // redefined from "Person"
  41.     {
  42.         return super.toString() +
  43.                "Student\n" +
  44.                "Student ID: " + SID + "\n";
  45.     }
  46. }
  47.  
  48.